#include<stdio.h>
#include<unistd.h>

int main(int argc,char* argv[])
{
  if(argc!=2)
  {
    printf("Usage: %s filename\n",argv[0]);
    return 1;
  }
  FILE* fp =fopen(argv[1],"r");
  if(fp==NULL)
  {
    perror("fopen");
    return 1;
  }
  char buffer[64];
  while(fgets(buffer,sizeof(buffer),fp)!=NULL)
  {
    printf("%s",buffer);
  }
  fclose(fp);
  //// chdir("./test_");
  //FILE* fp =fopen("log.txt","r");
  //if(fp==NULL)
  //{
  //  perror("fopen");
  //  return 1;
  //}
  //char buffer[64];
  //while(fgets(buffer,sizeof(buffer),fp)!=NULL)
  //{
  //  printf("echo:%s",buffer);
  //}

  //// printf("%d\n",getpid());

  ////while(1)
  ////{
  ////  sleep(1);
  ////}
  ////const char* msg="hello lxm";
  ////int cnt=1;
  ////while(cnt<=5)
  ////{
  ////  fprintf(fp,"%s,%d\n",msg,cnt++);
  ////}
  //fclose(fp);


  return 0;
}
